<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Edit Timeslots</title>

    <style type="text/css">
    </style>
</head>
<body>
<f:view>
<h:messages errorStyle="color: #ff0000" globalOnly="false"/>
    
        <table> 
        
        
            <tr><td colspan=3><strong>Timeslots for ${timeslotHandler.currentPosition.name}</strong></td>
	        		<%-- Workaround for invoking action in a faces dataTable --%>          
		            <c:forEach items="${timeslotHandler.currentPosition.timeSlots}" var="timeslot" >
		           <h:form>

			        	<tr>
				        <td><fmt:formatDate value="${timeslot.startTime}" type="time" timeStyle="short" timeZone="America/Chicago"/> - <fmt:formatDate value="${timeslot.endTime}" type="time" timeStyle="short" timeZone="America/Chicago"/></td>
				        <td><c:out value="${timeslot.numberOfVolunteers}" /> Volunteers</td>
				        <td><input type="hidden" name="currentTimeslotId" value="${timeslot.timeSlotId}" />
				        <h:commandLink value="Remove" action="#{timeslotHandler.removeTimeslot}" >

	        			<f:param name="currentPositionId" value="#{timeslotHandler.currentPositionId}" />
	        		</h:commandLink>
				        </td></tr>
	        		</h:form>
	        		</c:forEach>
	        		<tr><td>
	        		<h:form id="timeSlotForm">
	        		<h:commandLink value="Add New" action="#{timeslotHandler.addToPosition}">
	        			<f:param name="currentPositionId" value="#{timeslotHandler.currentPositionId}" />
	        		</h:commandLink>
	        		</h:form></td></tr>
	        	</table>
        <br>
    <a href="myEvents.jsf" />Back to My Events</a>
</f:view>
</body>
</html>